package com.fxz.oauth.annotation;

import com.fxz.oauth.validation.EmailValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @author Fxz
 * @version 1.0
 * @date 2021-08-03 16:40
 */
//Target注解决定PasswordMatches注解可以加在哪些成分上，如加在类身上，或者属性身上，或者方法身上等成分
@Target({TYPE, FIELD, ANNOTATION_TYPE})
//Retention注解决定ValidPassword注解的生命周期
@Retention(RUNTIME)
//处理逻辑是EmailValidator
@Constraint(validatedBy = EmailValidator.class)
//说明该注解将被包含在javadoc中
@Documented
public @interface ValidEmail {

    String message() default "ValidEmail email";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
